#ifndef _TETRAD_H_
#define _TETRAD_H_

#include "Image.h"
#include "Constants.h"

class CBlocksMatrix;

class CTetrad
{
public:

	CTetrad(CBlocksMatrix* pParent, EBlockColor blockColor) 
		: m_pParentMatrix(pParent), m_iXPos(0), m_iYPos(0), 
		  m_Orientation(Rotation0), m_pBlockImg(NULL), m_BlockColor(blockColor)  
	{ 
		switch (blockColor)
		{
		case trungga:
			m_pBlockImg = CImage::CreateImage("trung.PNG",
					TRectanglei(0,BLOCK_HEIGHT,0,BLOCK_WIDTH));
			break;
		case chatthaivat:
			m_pBlockImg = CImage::CreateImage("chatthai.PNG",
					TRectanglei(0,BLOCK_HEIGHT,0,BLOCK_WIDTH));
			break;
		case vat_convit:
			m_pBlockImg = CImage::CreateImage("vit.PNG",
					TRectanglei(0,vat_cao,0,vat_rong));
			break;
			case vat_conngan:
			m_pBlockImg = CImage::CreateImage("ngan.PNG",
					TRectanglei(0,vat_cao,0,vat_rong));
			break;
			case vat_conga:
			m_pBlockImg = CImage::CreateImage("ga.PNG",
					TRectanglei(0,vat_cao,0,vat_rong));
			break;
			case  vat_cairo:
				m_iXPos=7;
				m_iYPos=13;
			m_pBlockImg = CImage::CreateImage("ro.PNG",
					TRectanglei(0,cairo_cao,0,cairo_rong));
			break;
		}
	}
	virtual ~CTetrad() { }
	virtual bool Rotate() = 0;

	virtual bool MoveLeft() = 0;
	
	virtual bool MoveRight() = 0;
	
	virtual bool MoveDown() = 0;

	
	virtual void FillMatrix() = 0;
	
	virtual bool IsValid() = 0;

	virtual void Draw() = 0;
	
	virtual void DrawOnScreen(const TRectanglei& rect) = 0;
	int m_iXPos;
	int m_iYPos;
	bool co;
	int thoigian;
	int settortr;
protected:
	
	CBlocksMatrix* m_pParentMatrix;

	enum EOrientation
	{
		Rotation0,
		Rotation90,
		Rotation180,
		Rotation270,
	};

	EOrientation m_Orientation;


	TImagePtr m_pBlockImg;

	EBlockColor m_BlockColor;
};

#endif 